home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / FileTransfers.p < prev    next >
Text File  |  1996-05-01  |  11KB  |  321 lines

  1. {
  2.      File:        FileTransfers.p
  3.  
  4.      Contains:    CommToolbox File Transfer Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT FileTransfers;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __FILETRANSFERS__}
  28. {$SETC __FILETRANSFERS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC FileTransfersIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __WINDOWS__}
  35. {$I Windows.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __STANDARDFILE__}
  38. {$I StandardFile.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __CTBUTILITIES__}
  41. {$I CTBUtilities.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __CONNECTIONS__}
  44. {$I Connections.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __FILES__}
  47. {$I Files.p}
  48. {$ENDC}
  49. {$IFC UNDEFINED __TERMINALS__}
  50. {$I Terminals.p}
  51. {$ENDC}
  52.  
  53. {$PUSH}
  54. {$ALIGN MAC68K}
  55. {$LibExport+}
  56.  
  57. {$IFC FOR_SYSTEM7_ONLY }
  58.  
  59. CONST
  60.                                                                 {  current file transfer manager version     }
  61.     curFTVersion                = 2;                            {  FTErr     }
  62.     ftGenericError                = -1;
  63.     ftNoErr                        = 0;
  64.     ftRejected                    = 1;
  65.     ftFailed                    = 2;
  66.     ftTimeOut                    = 3;
  67.     ftTooManyRetry                = 4;
  68.     ftNotEnoughDSpace            = 5;
  69.     ftRemoteCancel                = 6;
  70.     ftWrongFormat                = 7;
  71.     ftNoTools                    = 8;
  72.     ftUserCancel                = 9;
  73.     ftNotSupported                = 10;
  74.  
  75.  
  76. TYPE
  77.     FTErr                                = OSErr;
  78.  
  79. CONST
  80.     ftIsFTMode                    = $01;
  81.     ftNoMenus                    = $02;
  82.     ftQuiet                        = $04;
  83.     ftConfigChanged                = $10;
  84.     ftSucc                        = $80;
  85.  
  86.  
  87. TYPE
  88.     FTFlags                                = LONGINT;
  89.  
  90. CONST
  91.     ftSameCircuit                = $01;
  92.     ftSendDisable                = $02;
  93.     ftReceiveDisable            = $04;
  94.     ftTextOnly                    = $08;
  95.     ftNoStdFile                    = $10;
  96.     ftMultipleFileSend            = $20;
  97.  
  98.  
  99. TYPE
  100.     FTAttributes                        = INTEGER;
  101.  
  102. CONST
  103.     ftReceiving                    = 0;
  104.     ftTransmitting                = 1;
  105.  
  106.  
  107. TYPE
  108.     FTDirection                            = INTEGER;
  109.     FileTransferDefProcPtr = ProcPtr;  { FUNCTION FileTransferDef(hTerm: TermHandle; msg: INTEGER; p1: LONGINT; p2: LONGINT; p3: LONGINT): LONGINT; }
  110.  
  111. {     application routines type definitions  }
  112.     FTRecordPtr = ^FTRecord;
  113.     FTPtr                                = ^FTRecord;
  114.     FTHandle                            = ^FTPtr;
  115.     FileTransferReadProcPtr = ProcPtr;  { FUNCTION FileTransferRead(VAR count: LONGINT; pData: Ptr; refCon: LONGINT; fileMsg: INTEGER): OSErr; }
  116.  
  117.     FileTransferWriteProcPtr = ProcPtr;  { FUNCTION FileTransferWrite(VAR count: LONGINT; pData: Ptr; refCon: LONGINT; fileMsg: INTEGER): OSErr; }
  118.  
  119.     FileTransferSendProcPtr = ProcPtr;  { FUNCTION FileTransferSend(thePtr: Ptr; theSize: LONGINT; refCon: LONGINT; channel: CMChannel; flag: CMFlags): Size; }
  120.  
  121.     FileTransferReceiveProcPtr = ProcPtr;  { FUNCTION FileTransferReceive(thePtr: Ptr; theSize: LONGINT; refCon: LONGINT; channel: CMChannel; VAR flag: CMFlags): Size; }
  122.  
  123.     FileTransferEnvironsProcPtr = ProcPtr;  { FUNCTION FileTransferEnvirons(refCon: LONGINT; VAR theEnvirons: ConnEnvironRec): OSErr; }
  124.  
  125.     FileTransferNotificationProcPtr = ProcPtr;  { PROCEDURE FileTransferNotification(hFT: FTHandle; pFSSpec: FSSpecPtr); }
  126.  
  127.     FileTransferChooseIdleProcPtr = ProcPtr;  { PROCEDURE FileTransferChooseIdle; }
  128.  
  129.     FileTransferDefUPP = UniversalProcPtr;
  130.     FileTransferReadUPP = UniversalProcPtr;
  131.     FileTransferWriteUPP = UniversalProcPtr;
  132.     FileTransferSendUPP = UniversalProcPtr;
  133.     FileTransferReceiveUPP = UniversalProcPtr;
  134.     FileTransferEnvironsUPP = UniversalProcPtr;
  135.     FileTransferNotificationUPP = UniversalProcPtr;
  136.     FileTransferChooseIdleUPP = UniversalProcPtr;
  137.     FTRecord = RECORD
  138.         procID:                    INTEGER;
  139.         flags:                    FTFlags;
  140.         errCode:                FTErr;
  141.         refCon:                    LONGINT;
  142.         userData:                LONGINT;
  143.         defProc:                FileTransferDefUPP;
  144.         config:                    Ptr;
  145.         oldConfig:                Ptr;
  146.         environsProc:            FileTransferEnvironsUPP;
  147.         reserved1:                LONGINT;
  148.         reserved2:                LONGINT;
  149.         ftPrivate:                Ptr;
  150.         sendProc:                FileTransferSendUPP;
  151.         recvProc:                FileTransferReceiveUPP;
  152.         writeProc:                FileTransferWriteUPP;
  153.         readProc:                FileTransferReadUPP;
  154.         owner:                    WindowPtr;
  155.         direction:                FTDirection;
  156.         theReply:                SFReply;
  157.         writePtr:                LONGINT;
  158.         readPtr:                LONGINT;
  159.         theBuf:                    Ptr;
  160.         bufSize:                LONGINT;
  161.         autoRec:                Str255;
  162.         attributes:                FTAttributes;
  163.     END;
  164.  
  165.  
  166. CONST
  167.                                                                 {  FTReadProc messages  }
  168.     ftReadOpenFile                = 0;                            {  count = forkFlags, buffer = pblock from PBGetFInfo  }
  169.     ftReadDataFork                = 1;
  170.     ftReadRsrcFork                = 2;
  171.     ftReadAbort                    = 3;
  172.     ftReadComplete                = 4;
  173.     ftReadSetFPos                = 6;                            {  count = forkFlags, buffer = pBlock same as PBSetFPos  }
  174.     ftReadGetFPos                = 7;                            {  count = forkFlags, buffer = pBlock same as PBGetFPos  }
  175.                                                                 {  FTWriteProc messages  }
  176.     ftWriteOpenFile                = 0;                            {  count = forkFlags, buffer = pblock from PBGetFInfo  }
  177.     ftWriteDataFork                = 1;
  178.     ftWriteRsrcFork                = 2;
  179.     ftWriteAbort                = 3;
  180.     ftWriteComplete                = 4;
  181.     ftWriteFileInfo                = 5;
  182.     ftWriteSetFPos                = 6;                            {  count = forkFlags, buffer = pBlock same as PBSetFPos  }
  183.     ftWriteGetFPos                = 7;                            {  count = forkFlags, buffer = pBlock same as PBGetFPos  }
  184.                                                                 {     fork flags  }
  185.     ftOpenDataFork                = 1;
  186.     ftOpenRsrcFork                = 2;
  187.  
  188.     uppFileTransferDefProcInfo = $0000FEF0;
  189.     uppFileTransferReadProcInfo = $00002FE0;
  190.     uppFileTransferWriteProcInfo = $00002FE0;
  191.     uppFileTransferSendProcInfo = $0000AFF0;
  192.     uppFileTransferReceiveProcInfo = $0000EFF0;
  193.     uppFileTransferEnvironsProcInfo = $000003E0;
  194.     uppFileTransferNotificationProcInfo = $000003C0;
  195.     uppFileTransferChooseIdleProcInfo = $00000000;
  196.  
  197. FUNCTION NewFileTransferDefProc(userRoutine: FileTransferDefProcPtr): FileTransferDefUPP;
  198.     {$IFC NOT GENERATINGCFM }
  199.     INLINE $2E9F;
  200.     {$ENDC}
  201.  
  202. FUNCTION NewFileTransferReadProc(userRoutine: FileTransferReadProcPtr): FileTransferReadUPP;
  203.     {$IFC NOT GENERATINGCFM }
  204.     INLINE $2E9F;
  205.     {$ENDC}
  206.  
  207. FUNCTION NewFileTransferWriteProc(userRoutine: FileTransferWriteProcPtr): FileTransferWriteUPP;
  208.     {$IFC NOT GENERATINGCFM }
  209.     INLINE $2E9F;
  210.     {$ENDC}
  211.  
  212. FUNCTION NewFileTransferSendProc(userRoutine: FileTransferSendProcPtr): FileTransferSendUPP;
  213.     {$IFC NOT GENERATINGCFM }
  214.     INLINE $2E9F;
  215.     {$ENDC}
  216.  
  217. FUNCTION NewFileTransferReceiveProc(userRoutine: FileTransferReceiveProcPtr): FileTransferReceiveUPP;
  218.     {$IFC NOT GENERATINGCFM }
  219.     INLINE $2E9F;
  220.     {$ENDC}
  221.  
  222. FUNCTION NewFileTransferEnvironsProc(userRoutine: FileTransferEnvironsProcPtr): FileTransferEnvironsUPP;
  223.     {$IFC NOT GENERATINGCFM }
  224.     INLINE $2E9F;
  225.     {$ENDC}
  226.  
  227. FUNCTION NewFileTransferNotificationProc(userRoutine: FileTransferNotificationProcPtr): FileTransferNotificationUPP;
  228.     {$IFC NOT GENERATINGCFM }
  229.     INLINE $2E9F;
  230.     {$ENDC}
  231.  
  232. FUNCTION NewFileTransferChooseIdleProc(userRoutine: FileTransferChooseIdleProcPtr): FileTransferChooseIdleUPP;
  233.     {$IFC NOT GENERATINGCFM }
  234.     INLINE $2E9F;
  235.     {$ENDC}
  236.  
  237. FUNCTION CallFileTransferDefProc(hTerm: TermHandle; msg: INTEGER; p1: LONGINT; p2: LONGINT; p3: LONGINT; userRoutine: FileTransferDefUPP): LONGINT;
  238.     {$IFC NOT GENERATINGCFM}
  239.     INLINE $205F, $4E90;
  240.     {$ENDC}
  241.  
  242. FUNCTION CallFileTransferReadProc(VAR count: LONGINT; pData: Ptr; refCon: LONGINT; fileMsg: INTEGER; userRoutine: FileTransferReadUPP): OSErr;
  243.     {$IFC NOT GENERATINGCFM}
  244.     INLINE $205F, $4E90;
  245.     {$ENDC}
  246.  
  247. FUNCTION CallFileTransferWriteProc(VAR count: LONGINT; pData: Ptr; refCon: LONGINT; fileMsg: INTEGER; userRoutine: FileTransferWriteUPP): OSErr;
  248.     {$IFC NOT GENERATINGCFM}
  249.     INLINE $205F, $4E90;
  250.     {$ENDC}
  251.  
  252. FUNCTION CallFileTransferSendProc(thePtr: Ptr; theSize: LONGINT; refCon: LONGINT; channel: CMChannel; flag: CMFlags; userRoutine: FileTransferSendUPP): Size;
  253.     {$IFC NOT GENERATINGCFM}
  254.     INLINE $205F, $4E90;
  255.     {$ENDC}
  256.  
  257. FUNCTION CallFileTransferReceiveProc(thePtr: Ptr; theSize: LONGINT; refCon: LONGINT; channel: CMChannel; VAR flag: CMFlags; userRoutine: FileTransferReceiveUPP): Size;
  258.     {$IFC NOT GENERATINGCFM}
  259.     INLINE $205F, $4E90;
  260.     {$ENDC}
  261.  
  262. FUNCTION CallFileTransferEnvironsProc(refCon: LONGINT; VAR theEnvirons: ConnEnvironRec; userRoutine: FileTransferEnvironsUPP): OSErr;
  263.     {$IFC NOT GENERATINGCFM}
  264.     INLINE $205F, $4E90;
  265.     {$ENDC}
  266.  
  267. PROCEDURE CallFileTransferNotificationProc(hFT: FTHandle; pFSSpec: FSSpecPtr; userRoutine: FileTransferNotificationUPP);
  268.     {$IFC NOT GENERATINGCFM}
  269.     INLINE $205F, $4E90;
  270.     {$ENDC}
  271.  
  272. PROCEDURE CallFileTransferChooseIdleProc(userRoutine: FileTransferChooseIdleUPP);
  273.     {$IFC NOT GENERATINGCFM}
  274.     INLINE $205F, $4E90;
  275.     {$ENDC}
  276. FUNCTION InitFT: FTErr;
  277. FUNCTION FTGetVersion(hFT: FTHandle): Handle;
  278. FUNCTION FTGetFTVersion: INTEGER;
  279. FUNCTION FTNew(procID: INTEGER; flags: FTFlags; sendProc: FileTransferSendUPP; recvProc: FileTransferReceiveUPP; readProc: FileTransferReadUPP; writeProc: FileTransferWriteUPP; environsProc: FileTransferEnvironsUPP; owner: WindowPtr; refCon: LONGINT; userData: LONGINT): FTHandle;
  280. PROCEDURE FTDispose(hFT: FTHandle);
  281. FUNCTION FTStart(hFT: FTHandle; direction: FTDirection; {CONST}VAR fileInfo: SFReply): FTErr;
  282. FUNCTION FTAbort(hFT: FTHandle): FTErr;
  283. FUNCTION FTSend(hFT: FTHandle; numFiles: INTEGER; pFSSpec: FSSpecArrayPtr; notifyProc: FileTransferNotificationUPP): FTErr;
  284. FUNCTION FTReceive(hFT: FTHandle; pFSSpec: FSSpecPtr; notifyProc: FileTransferNotificationUPP): FTErr;
  285. PROCEDURE FTExec(hFT: FTHandle);
  286. PROCEDURE FTActivate(hFT: FTHandle; activate: BOOLEAN);
  287. PROCEDURE FTResume(hFT: FTHandle; resume: BOOLEAN);
  288. FUNCTION FTMenu(hFT: FTHandle; menuID: INTEGER; item: INTEGER): BOOLEAN;
  289. FUNCTION FTChoose(VAR hFT: FTHandle; where: Point; idleProc: FileTransferChooseIdleUPP): INTEGER;
  290. PROCEDURE FTEvent(hFT: FTHandle; {CONST}VAR theEvent: EventRecord);
  291. FUNCTION FTValidate(hFT: FTHandle): BOOLEAN;
  292. PROCEDURE FTDefault(VAR theConfig: Ptr; procID: INTEGER; allocate: BOOLEAN);
  293. FUNCTION FTSetupPreflight(procID: INTEGER; VAR magicCookie: LONGINT): Handle;
  294. PROCEDURE FTSetupSetup(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR magicCookie: LONGINT);
  295. FUNCTION FTSetupFilter(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR theEvent: EventRecord; VAR theItem: INTEGER; VAR magicCookie: LONGINT): BOOLEAN;
  296. PROCEDURE FTSetupItem(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR theItem: INTEGER; VAR magicCookie: LONGINT);
  297. PROCEDURE FTSetupXCleanup(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; OKed: BOOLEAN; VAR magicCookie: LONGINT);
  298. PROCEDURE FTSetupPostflight(procID: INTEGER);
  299. FUNCTION FTGetConfig(hFT: FTHandle): Ptr;
  300. FUNCTION FTSetConfig(hFT: FTHandle; thePtr: UNIV Ptr): INTEGER;
  301. FUNCTION FTIntlToEnglish(hFT: FTHandle; inputPtr: UNIV Ptr; VAR outputPtr: Ptr; language: INTEGER): OSErr;
  302. FUNCTION FTEnglishToIntl(hFT: FTHandle; inputPtr: UNIV Ptr; VAR outputPtr: Ptr; language: INTEGER): OSErr;
  303. PROCEDURE FTGetToolName(procID: INTEGER; VAR name: Str255);
  304. FUNCTION FTGetProcID(name: Str255): INTEGER;
  305. PROCEDURE FTSetRefCon(hFT: FTHandle; refCon: LONGINT);
  306. FUNCTION FTGetRefCon(hFT: FTHandle): LONGINT;
  307. PROCEDURE FTSetUserData(hFT: FTHandle; userData: LONGINT);
  308. FUNCTION FTGetUserData(hFT: FTHandle): LONGINT;
  309. PROCEDURE FTGetErrorString(hFT: FTHandle; id: INTEGER; VAR errMsg: Str255);
  310. {$ENDC}
  311. {$ALIGN RESET}
  312. {$POP}
  313.  
  314. {$SETC UsingIncludes := FileTransfersIncludes}
  315.  
  316. {$ENDC} {__FILETRANSFERS__}
  317.  
  318. {$IFC NOT UsingIncludes}
  319.  END.
  320. {$ENDC}
  321.